﻿using UnityEngine;
using System.Collections;

public class Flash : MonoBehaviour {
	public float duration;
	public Vector3 direction;
	float startTime, endTime;
	// Use this for initialization
	void Start () {
		startTime = Time.time;
		endTime = startTime + duration;
		setDirection (direction);
	}

	public void setDirection(Vector3 direction) {
		this.direction = direction;
		transform.rotation = Quaternion.Euler (direction);
	}
	
	// Update is called once per frame
	void Update () {
		if((Time.time - endTime) > 0f) {
			Destroy (gameObject);
		}
	}
}
